<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/' }">个人信息</el-breadcrumb-item>
      <el-breadcrumb-item>
        <a href="/">个人资料</a>
      </el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 变更记录 -->
    <div class="changeRecordDiv">
      <p>变更记录</p>
      <el-table :data="tableData" border style="width: 97%" :header-cell-style="rowClass">
        <el-table-column type="index" label="编号" width="80"></el-table-column>
        <el-table-column prop="originalCompany" label="原单位名称" width="175"></el-table-column>
        <el-table-column prop="area" label="原单位地区" width="120"></el-table-column>
        <el-table-column prop="outCompany" label="迁往单位名称" width="120"></el-table-column>
        <el-table-column prop="address" label="迁往单位地区" width="300"></el-table-column>
        <el-table-column prop="outStatus" label="审核状态" width="120"></el-table-column>
        <el-table-column prop="companyCertificate" label="审批说明" width="120"></el-table-column>
        <el-table-column prop="outTime" label="审批时间" width="120"></el-table-column>
        <el-table-column label="操作" width="100">
          <template slot-scope="scope">
            <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-button plain @click="back" class="btn_css">返回</el-button>
    </div>
    <!-- 分页 -->
    <div class="block page_css">
      <el-pagination
        layout="prev, pager, next"
        :total="total"
        :page-size="limit"
        @current-change="change"
        @prev-click="prev"
        @next-click="next"
      ></el-pagination>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      page: 1,
      limit: 5,
      total: 0,
      tableData: []
    };
  },
  methods: {
    getCon() {
      this.$axios({
        url: "/move/list",
        method: "post",
        data: {
          page: this.page,
          limit: this.limit
        }
      }).then(res => {
        console.log(res.data.data);
        this.tableData = res.data.data;
        this.total = res.data.count;
      });
    },
    /* 分页渲染 */
    change(page) {
      this.page = page;
      this.getCon();
    },
    prev() {
      this.page--;
      this.getCon();
    },
    next() {
      this.page++;
      this.getCon();
    },
    handleClick(row) {
      console.log(row);
      this.$router.push("/personalinformation/seechangerecord");
    },
    /* 改变表头背景颜色 */
    rowClass() {
      return "background:#F4F4F4;";
    },
    back() {
      this.$router.push("/personalinformation/personaldata");
    }
  },
  mounted() {
    this.getCon();
    sessionStorage.setItem("fName", "ChangeRecord");
  }
};
</script>
<style scoped lang="less">
.page_css {
  margin: 10px;
  text-align: right; 
  margin-right: 80px;
}
.changeRecordDiv {
  width: 100%;
  //   height: 400px;
  margin: 30px 0;
  //   text-align: center;
  border: 1px solid #ddd;
  p {
    background-color: #f4f4f4;
    height: 40px;
    font-size: 16px;
    line-height: 40px;
    padding-left: 20px;
    color: #999;
    border-bottom: 1px solid #ddd;
  }
  .el-table {
    margin: 24px 17px;
  }
  .btn_css {
    width: 150px;
    height: 40px;
    display: block;
    margin: 20px auto;
    background-color: #f7f7f7;
    // border: 1px solid #eee;
    text-align: center;
  }
}
</style>